<template>
  <el-dialog
    v-el-drag-dialog
    title="可即查即改项"
    :visible.sync="visible"
    width="700px"
  >
    <el-table
      :data="tableData"
      style="width: 100%;"
    >
      <el-table-column
        prop="idx"
        label="序号"
        width="50"
      />
      <el-table-column
        prop="itemName"
        label="可即查即改项"
      />
      <el-table-column
        prop="itemDetailName"
        label="安检结果"
        width="180"
      />
      <el-table-column
        prop="isModification"
        width="120"
        label="整改情况"
      >
        <template slot-scope="scope">
          {{ scope.row.isModification?scope.row.isModification===1?'未整改':scope.row.isModification===2?'已整改':'':'' }}
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
  import { modificationList } from '@/api'
  export default {
    name: 'checkandFix',
    data() {
      return {
        visible: false,
        tableData: []
      }
    },
    methods: {
      open(val) {
        this.visible = true
        if (val) {
          this.getData(val)
        }
      },
      async getData(val) {
        const params = {
          corpSN: val.corpSN,
          checkId: val.checkId,
          queryType: 1
        }
        const res = await modificationList(params)
        this.tableData = res.data.map((item, index) => ({
          ...item,
          idx: index + 1
        }))
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
